using UnityEngine;
using UnityEngine.UI;

namespace GameKitUnity.UI
{
    public class UIMask : MonoBehaviour
    {
        [SerializeField]
        private Color color = new(0, 0, 0, 0.76f);

        private void Awake()
        {
            var maskImage = GetComponent<Image>();
            if (!maskImage)
            {
                maskImage = gameObject.AddComponent<Image>();
            }

            maskImage.color = color;
            maskImage.raycastTarget = true;

            var rectTransform = maskImage.GetComponent<RectTransform>();
            rectTransform.Stretch();
        }
    }
}